//
//  ServiceBuyseTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/10.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "ServiceBuyseTableViewCell.h"

@interface ServiceBuyseTableViewCell ()
@property (nonatomic,strong) GLGWLabel * stellNameLabel;
@property (nonatomic,strong) GLGWLabel * cooperationLabel;
@property (nonatomic,strong) GLGWButton * editBut;

@property (nonatomic,strong) GLGWLabel * namePhoneLabel;
@property (nonatomic,strong) GLGWLabel * adressLabel;

@end

@implementation ServiceBuyseTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        GLGWView * bankgroundView = [[GLGWView alloc] initWithInSuperView:self.contentView];
        bankgroundView.backgroundColor = [UIColor whiteColor];
        [bankgroundView setViewShadowWidth:3.0 theCornerRadius:6.0];
        [bankgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(5));
        }];
        //
        self.cooperationLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor whiteColor] inSuperView:bankgroundView];
        self.cooperationLabel.textAlignment = NSTextAlignmentCenter;
        [self.cooperationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(bankgroundView.mas_right).offset(kWidthProportion_In_iPhoneTriploid(3));
            make.top.equalTo(bankgroundView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(15));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(54)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(18)));
        }];
        //
        self.stellNameLabel = [[GLGWLabel alloc] initWithFont:BOLDSYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:bankgroundView];
        self.stellNameLabel.text = @"北京泽人合物资有限公司";
        [self.stellNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(bankgroundView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(bankgroundView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(30)));
        }];
        //
        self.editBut = [[GLGWButton alloc] initInSuperView:bankgroundView];
        self.editBut.image_Name = @"my_xiugai";
        [self.editBut mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.stellNameLabel.mas_right).offset(kWidthProportion_In_iPhoneTriploid(10));
            make.centerY.equalTo(self.stellNameLabel);
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(14)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(14)));
        }];
        [self.editBut addTarget:self action:@selector(serviceEdit) forControlEvents:UIControlEventTouchUpInside];
        //
        self.namePhoneLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:bankgroundView];
        self.namePhoneLabel.text = @"王毅   010-00000000";
        [self.namePhoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.stellNameLabel);
            make.top.equalTo(self.stellNameLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(8));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];
        //
        self.adressLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:bankgroundView];
        self.adressLabel.text = @"北京市朝阳区左家庄中街23号";
        [self.adressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.namePhoneLabel);
            make.top.equalTo(self.namePhoneLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(6));
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
        }];
    }
    return self;
}

-(void)serviceEdit{
    if (self.Block_ServiceEdit) {
        self.Block_ServiceEdit();
    }
}

-(void)setInforModel:(ServiceBuyersModel_Infos *)inforModel{
    _inforModel = inforModel;
    self.stellNameLabel.text = _inforModel.enterpriseName;
    self.namePhoneLabel.text = [NSString stringWithFormat:@"%@   %@",_inforModel.contactPerson,_inforModel.contactPhone];
    self.adressLabel.text = _inforModel.address;
    if (_inforModel.status == 1) {
        self.cooperationLabel.text = @"合作中";
        self.cooperationLabel.backgroundColor = kColor_Rule_Yellow;
    }else{
        self.cooperationLabel.text = @"已取消";
        self.cooperationLabel.backgroundColor = [UIColor colorWithHexString:@"#999999"];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
